<template>
  <div class="dashboard-container">
    <div>
      <div class="dashboard-text text-blue">欢迎 {{ username }} 登陆如期业务管理系统</div>

      <!-- <p>• 所在部门：{{ loginInfo.department }}</p> -->
      <p><span class="text-info">• 本次登录：</span>{{ loginInfo.thisTime |formatDateToStr }}</p>
      <p><span class="text-info">• 登录地区 ：</span>广东省深圳市(IP:{{ loginInfo.thisIp }})</p>
      <p><span class="text-info">• 上次登录：</span>{{ loginInfo.lastTime |formatDateToStr }}</p>
    </div>
    <!-- <div>
      <div class="dashboard-entry text-blue"><span class="el-icon-s-data" />快捷入口</div>
    </div> -->
  </div>
</template>

<script>
import { queryUserLogin } from '@/api/api'

export default {
  name: 'Dashboard',

  data() {
    return {
      loginInfo: {
        lastTime: '',
        thisTime: '',
        thisIp: ''
      },
      username: 'admin',
      tableListLoading: false
    }
  },
  mounted() {
    this.username = sessionStorage.getItem('username')
    this.queryUserLogin()
  },
  methods: {
    queryUserLogin() {
      this.tableListLoading = true
      const params = {
        username: this.username
      }
      queryUserLogin(params).then(res => {
        this.tableListLoading = false
        this.loginInfo = res.data
      }).catch(error => {
        this.tableListLoading = false
        this.$message.error(error)
      })
    }
  }

}

</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
    height: 100%;
    margin-top: 90px;
    // background-color: #eeeeee;
  }
  &-text {
    font-size: 20px;
    font-weight: bold;
    line-height: 46px;
  }
  &-text {
    // font-size: 20px;
    font-weight: bold;
    line-height: 46px;
  }
}
</style>
